<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
          padding: 0;
          margin: 0;
        }
  
        .wrap {
          width: 600px;
          margin: 100px auto 0;
        }
  
        table {
          border-collapse: collapse;
          border-spacing: 0;
          width: 600px;
          /* border: 1px solid #c0c0c0; */
        }
  
        th,
        td {
          /* border: 1px solid #d0d0d0; */
          color: #404060;
          padding: 10px;
        }
        td {
          border: 1px solid #d0d0d0;
        }
  
        th {
          background-color: #09c;
          font: bold 16px "微软雅黑";
          color: #fff;
        }
  
        td {
          font: 14px "微软雅黑";
        }
  
        tbody tr {
          background-color: #f0f0f0;
        }
  
        tbody tr:hover {
          cursor: pointer;
          background-color: #fafafa;
        }
      </style>
</head>
<body>
    <div class="wrap">
        <table>
          <thead>
            <tr>
              <th>
                <input type="checkbox" id="zong" />
              </th>
              <th>英雄名称</th>
              <th>所属阵营</th>
            </tr>
          </thead>
          <tbody id="dan">
            <tr>
              <td>
                <input type="checkbox" />
              </td>
              <td>德莱厄斯</td>
              <td>诺克萨斯</td>
            </tr>
            <tr>
              <td>
                <input type="checkbox" />
              </td>
              <td>盖伦</td>
              <td>德玛西亚</td>
            </tr>
            <tr>
              <td>
                <input type="checkbox" />
              </td>
              <td>艾瑞莉娅</td>
              <td>艾欧尼亚</td>
            </tr>
            <tr>
              <td>
                <input type="checkbox" />
              </td>
              <td>丽桑卓</td>
              <td>弗雷尔卓德</td>
            </tr>
          </tbody>
        </table>
      </div>

      <script src="./lib/jquery-3.2.1.min.js"></script>
      <script>
          $(function() {
              $('#zong').click(function() {
                  $('#dan input').prop('checked', $('#zong').prop('checked'));
              })
          })
          $('#dan').click(function() {
              var bol=$('#dan input:checked').length==4;
              $('#zeng').prop('checked', bol);
          })
      </script>
</body>

</html>